height = 6)
par(mar = c(1.5, 2, 2 , 1), oma = c(4, 4,1.5, 0))
par(mfrow = c(2, 5))
plot(x = data1a$time,
y = data1a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
xlab = "", ylab = "",
pch = 16, cex.axis=1.25)
segments(x0 = data1a$time, x1 = data1a$time,
y0 = data1a$lower_b, y1 = data1a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data2a$time,
y = data2a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data2a$time, x1 = data2a$time,
y0 = data2a$lower_b, y1 = data2a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data3a$time,
y = data3a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data3a$time, x1 = data3a$time,
y0 = data3a$lower_b, y1 = data3a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data4a$time,
y = data4a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data4a$time, x1 = data4a$time,
y0 = data4a$lower_b, y1 = data4a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data5a$time,
y = data5a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data5a$time, x1 = data5a$time,
y0 = data5a$lower_b, y1 = data5a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data1b$time,
y = data1b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
xlab = "", ylab = "",
pch = 16, cex.axis=1.25)
segments(x0 = data1b$time, x1 = data1b$time,
y0 = data1b$lower_b, y1 = data1b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data2b$time,
y = data2b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data2b$time, x1 = data2b$time,
y0 = data2b$lower_b, y1 = data2b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data3b$time,
y = data3b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data3b$time, x1 = data3b$time,
y0 = data3b$lower_b, y1 = data3b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data4b$time,
y = data4b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data4b$time, x1 = data4b$time,
y0 = data4b$lower_b, y1 = data4b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data5b$time,
y = data5b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data5b$time, x1 = data5b$time,
y0 = data5b$lower_b, y1 = data5b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
mtext("Mahalanobis", line = -0.2, at = 0.11, outer = TRUE, cex = 1)
mtext("PS \n Matching", line = -1.8, at = 0.31, outer = TRUE, cex = 1)
mtext("PS \n Weighting", line = -1.8, at = 0.51, outer = TRUE, cex = 1)
mtext("CBPS \n Matching", line = -1.8, at = 0.71, outer = TRUE, cex = 1)
mtext("CBPS \n Weighting", line = -1.8, at = 0.91, outer = TRUE, cex = 1)
mtext("Left = Low", side = 2, line = .3, at = 0.75,
outer = TRUE, cex = 1)
mtext("Left = High", side = 2, line = .3, at = 0.25,
outer = TRUE, cex = 1)
mtext(1, text = "Years relative to the Onset of Sanctuary", line = 1.2,
at = 0.5, outer = TRUE, cex = 1)
dev.off()
rm(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5)
################################################################
# Preparing the data - Protest * Recruitment
################################################################
x1 <- summary(pe.results5.p2_maha5b_mod3[["No Recruitment"]])
x2 <- summary(pe.results5.p2_ps.m5_mod3[["No Recruitment"]])
x3 <- summary(pe.results5.p2_ps.w5_mod3[["No Recruitment"]])
x4 <- summary(pe.results5.p2_CBPSm5_mod3[["No Recruitment"]])
x5 <- summary(pe.results5.p2_CBPSw5_mod3[["No Recruitment"]])
y1 <- summary(pe.results5.p2_maha5b_mod3[["Recruitment"]])
y2 <- summary(pe.results5.p2_ps.m5_mod3[["Recruitment"]])
y3 <- summary(pe.results5.p2_ps.w5_mod3[["Recruitment"]])
y4 <- summary(pe.results5.p2_CBPSm5_mod3[["Recruitment"]])
y5 <- summary(pe.results5.p2_CBPSw5_mod3[["Recruitment"]])
data1a <- as.data.frame(x1$summary)
data1a <- data1a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data1a <- data1a %>%
mutate(time = c(0, 1, 2, 3, 4))
data2a <- as.data.frame(x2$summary)
data2a <- data2a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data2a <- data2a %>%
mutate(time = c(0, 1, 2, 3, 4))
data3a <- as.data.frame(x3$summary)
data3a <- data3a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data3a <- data3a %>%
mutate(time = c(0, 1, 2, 3, 4))
data4a <- as.data.frame(x4$summary)
data4a <- data4a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data4a <- data4a %>%
mutate(time = c(0, 1, 2, 3, 4))
data5a <- as.data.frame(x5$summary)
data5a <- data5a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data5a <- data5a %>%
mutate(time = c(0, 1, 2, 3, 4))
data1b <- as.data.frame(y1$summary)
data1b <- data1b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data1b <- data1b %>%
mutate(time = c(0, 1, 2, 3, 4))
data2b <- as.data.frame(y2$summary)
data2b <- data2b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data2b <- data2b %>%
mutate(time = c(0, 1, 2, 3, 4))
data3b <- as.data.frame(y3$summary)
data3b <- data3b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data3b <- data3b %>%
mutate(time = c(0, 1, 2, 3, 4))
data4b <- as.data.frame(y4$summary)
data4b <- data4b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data4b <- data4b %>%
mutate(time = c(0, 1, 2, 3, 4))
data5b <- as.data.frame(y5$summary)
data5b <- data5b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data5b <- data5b %>%
mutate(time = c(0, 1, 2, 3, 4))
################################################################
# Plots - Protest * Recruitment
################################################################
pdf(file = "/Users/SHSU/Desktop/Figure6.1.pdf",   # The directory you want to save the file in
width = 9, # The width of the plot in inches
height = 6)
par(mar = c(1.5, 2, 2 , 1), oma = c(4, 4,1.5, 0))
par(mfrow = c(2, 5))
plot(x = data1a$time,
y = data1a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
xlab = "", ylab = "",
pch = 16, cex.axis=1.25)
segments(x0 = data1a$time, x1 = data1a$time,
y0 = data1a$lower_b, y1 = data1a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data2a$time,
y = data2a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data2a$time, x1 = data2a$time,
y0 = data2a$lower_b, y1 = data2a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data3a$time,
y = data3a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data3a$time, x1 = data3a$time,
y0 = data3a$lower_b, y1 = data3a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data4a$time,
y = data4a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data4a$time, x1 = data4a$time,
y0 = data4a$lower_b, y1 = data4a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data5a$time,
y = data5a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data5a$time, x1 = data5a$time,
y0 = data5a$lower_b, y1 = data5a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data1b$time,
y = data1b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
xlab = "", ylab = "",
pch = 16, cex.axis=1.25)
segments(x0 = data1b$time, x1 = data1b$time,
y0 = data1b$lower_b, y1 = data1b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data2b$time,
y = data2b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data2b$time, x1 = data2b$time,
y0 = data2b$lower_b, y1 = data2b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data3b$time,
y = data3b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data3b$time, x1 = data3b$time,
y0 = data3b$lower_b, y1 = data3b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data4b$time,
y = data4b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data4b$time, x1 = data4b$time,
y0 = data4b$lower_b, y1 = data4b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data5b$time,
y = data5b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data5b$time, x1 = data5b$time,
y0 = data5b$lower_b, y1 = data5b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
mtext("Mahalanobis", line = -0.2, at = 0.11, outer = TRUE, cex = 1)
mtext("PS \n Matching", line = -1.8, at = 0.31, outer = TRUE, cex = 1)
mtext("PS \n Weighting", line = -1.8, at = 0.51, outer = TRUE, cex = 1)
mtext("CBPS \n Matching", line = -1.8, at = 0.71, outer = TRUE, cex = 1)
mtext("CBPS \n Weighting", line = -1.8, at = 0.91, outer = TRUE, cex = 1)
mtext("No Recruitment", side = 2, line = .3, at = 0.75,
outer = TRUE, cex = 1)
mtext("Recruitment", side = 2, line = .3, at = 0.25,
outer = TRUE, cex = 1)
mtext(1, text = "Years relative to the Onset of Protest", line = 1.2,
at = 0.5, outer = TRUE, cex = 1)
dev.off()
rm(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5)
################################################################
# Preparing the data - Sanctuary * Recruitment
################################################################
x1 <- summary(pe.results5.s2_maha5b_mod3[["No Recruitment"]])
x2 <- summary(pe.results5.s2_ps.m5_mod3[["No Recruitment"]])
x3 <- summary(pe.results5.s2_ps.w5_mod3[["No Recruitment"]])
x4 <- summary(pe.results5.s2_CBPSm5_mod3[["No Recruitment"]])
x5 <- summary(pe.results5.s2_CBPSw5_mod3[["No Recruitment"]])
y1 <- summary(pe.results5.s2_maha5b_mod3[["Recruitment"]])
y2 <- summary(pe.results5.s2_ps.m5_mod3[["Recruitment"]])
y3 <- summary(pe.results5.s2_ps.w5_mod3[["Recruitment"]])
y4 <- summary(pe.results5.s2_CBPSm5_mod3[["Recruitment"]])
y5 <- summary(pe.results5.s2_CBPSw5_mod3[["Recruitment"]])
data1a <- as.data.frame(x1$summary)
data1a <- data1a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data1a <- data1a %>%
mutate(time = c(0, 1, 2, 3, 4))
data2a <- as.data.frame(x2$summary)
data2a <- data2a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data2a <- data2a %>%
mutate(time = c(0, 1, 2, 3, 4))
data3a <- as.data.frame(x3$summary)
data3a <- data3a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data3a <- data3a %>%
mutate(time = c(0, 1, 2, 3, 4))
data4a <- as.data.frame(x4$summary)
data4a <- data4a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data4a <- data4a %>%
mutate(time = c(0, 1, 2, 3, 4))
data5a <- as.data.frame(x5$summary)
data5a <- data5a %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data5a <- data5a %>%
mutate(time = c(0, 1, 2, 3, 4))
data1b <- as.data.frame(y1$summary)
data1b <- data1b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data1b <- data1b %>%
mutate(time = c(0, 1, 2, 3, 4))
data2b <- as.data.frame(y2$summary)
data2b <- data2b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data2b <- data2b %>%
mutate(time = c(0, 1, 2, 3, 4))
data3b <- as.data.frame(y3$summary)
data3b <- data3b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data3b <- data3b %>%
mutate(time = c(0, 1, 2, 3, 4))
data4b <- as.data.frame(y4$summary)
data4b <- data4b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data4b <- data4b %>%
mutate(time = c(0, 1, 2, 3, 4))
data5b <- as.data.frame(y5$summary)
data5b <- data5b %>%
rename(lower_b = "2.5%",
upper_b = "97.5%")
data5b <- data5b %>%
mutate(time = c(0, 1, 2, 3, 4))
################################################################
# Plots - Sanctuary * Recruitment
################################################################
pdf(file = "/Users/SHSU/Desktop/Figure6.2.pdf",   # The directory you want to save the file in
width = 9, # The width of the plot in inches
height = 6)
par(mar = c(1.5, 2, 2 , 1), oma = c(4, 4,1.5, 0))
par(mfrow = c(2, 5))
plot(x = data1a$time,
y = data1a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
xlab = "", ylab = "",
pch = 16, cex.axis=1.25)
segments(x0 = data1a$time, x1 = data1a$time,
y0 = data1a$lower_b, y1 = data1a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data2a$time,
y = data2a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data2a$time, x1 = data2a$time,
y0 = data2a$lower_b, y1 = data2a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data3a$time,
y = data3a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data3a$time, x1 = data3a$time,
y0 = data3a$lower_b, y1 = data3a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data4a$time,
y = data4a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data4a$time, x1 = data4a$time,
y0 = data4a$lower_b, y1 = data4a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data5a$time,
y = data5a$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data5a$time, x1 = data5a$time,
y0 = data5a$lower_b, y1 = data5a$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data1b$time,
y = data1b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
xlab = "", ylab = "",
pch = 16, cex.axis=1.25)
segments(x0 = data1b$time, x1 = data1b$time,
y0 = data1b$lower_b, y1 = data1b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data2b$time,
y = data2b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data2b$time, x1 = data2b$time,
y0 = data2b$lower_b, y1 = data2b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data3b$time,
y = data3b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data3b$time, x1 = data3b$time,
y0 = data3b$lower_b, y1 = data3b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data4b$time,
y = data4b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data4b$time, x1 = data4b$time,
y0 = data4b$lower_b, y1 = data4b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
plot(x = data5b$time,
y = data5b$estimate,
main = "",
ylim = c(-30, 30), xlim = c(-0.5, 4.5),
xaxp = c(0, 4, 4), yaxp = c(-30, 30, 4),
pch = 16, yaxt = "n", cex.axis=1.25)
segments(x0 = data5b$time, x1 = data5b$time,
y0 = data5b$lower_b, y1 = data5b$upper_b,
lwd = 1, col = "black")
abline(h = 0, lty = 2)
mtext("Mahalanobis", line = -0.2, at = 0.11, outer = TRUE, cex = 1)
mtext("PS \n Matching", line = -1.8, at = 0.31, outer = TRUE, cex = 1)
mtext("PS \n Weighting", line = -1.8, at = 0.51, outer = TRUE, cex = 1)
mtext("CBPS \n Matching", line = -1.8, at = 0.71, outer = TRUE, cex = 1)
mtext("CBPS \n Weighting", line = -1.8, at = 0.91, outer = TRUE, cex = 1)
mtext("No Recruitment", side = 2, line = .3, at = 0.75,
outer = TRUE, cex = 1)
mtext("Recruitment", side = 2, line = .3, at = 0.25,
outer = TRUE, cex = 1)
mtext(1, text = "Years relative to the Onset of Sanctuary", line = 1.2,
at = 0.5, outer = TRUE, cex = 1)
dev.off()
rm(x1, x2, x3, x4, x5, y1, y2, y3, y4, y5)
load("~/Library/Mobile Documents/com~apple~CloudDocs/Documents/Sam Houston State University/1.ResearchAgenda&Pipeline/Project1/Replication/1.MainAnalysis/OMC-Updated_DV2.1&CV5b.1.RData")
View(msets.CBPSm5.p)
